//
//  ChannelEpisodeController.swift
//  DoctorVisits
//
//  Created by lanou3g on 16/3/1.
//  Copyright © 2016年 SHH. All rights reserved.
//

import UIKit

class ChannelEpisodeController: UIViewController {


    
    override func viewDidLoad() {
        super.viewDidLoad()
        
      self.view.backgroundColor = UIColor.groupTableViewBackgroundColor()
        
//        let width = self.view.frame.size.width
//        let height = self.view.frame.size.height
        var count:Int = 0
        for var i = 0; i<5; i++ {
            for var j = 0;j<5; j++ {
                count++
                let episodeBut:UIButton = UIButton()
                episodeBut.frame = CGRectMake(((self.view.frame.size.width-30)/5+5)*CGFloat(j)+5, 45*CGFloat(i)+5, (self.view.frame.size.width-30)/5,40)
                episodeBut.backgroundColor = UIColor.whiteColor()
                episodeBut.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
                self.view.addSubview(episodeBut)
                episodeBut.setTitle(String(count), forState: UIControlState.Normal)
                episodeBut.addTarget(self, action: Selector("buttonAction"), forControlEvents: UIControlEvents.TouchUpInside)
              
            }
            
        }
        
        
    }
    
    func buttonAction(){
    
        print("aaa")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
